package cn.rengy.web.framework.wxmp;

import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresRoles;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.rengy.lang.ResultEntity;


/**
 * 微信商户号
 * 
 */
@Controller
@RequestMapping
public class WxMerchantController {
	private static Logger logger = LoggerFactory.getLogger(WxMerchantController.class);
	@Autowired
	private WxMerchantService wxMerchantService;
	
	/**
	 * 新增商户号
	 * @param paramMap
	 * @return
	 */
	@RequiresRoles(value={"admin"})
	@RequestMapping(value="/authenticated/wxmerchant/add",method = RequestMethod.POST)
	@ResponseBody
	public ResultEntity add (@RequestBody Map<String,Object> paramMap){
		wxMerchantService.add(paramMap);
		return ResultEntity.ok();
	}
	@RequiresRoles(value={"admin"})
	@RequestMapping(value="/authenticated/wxmerchant/update",method = RequestMethod.POST)
	@ResponseBody
	public ResultEntity update (@RequestBody Map<String,Object> paramMap){
		wxMerchantService.update(paramMap);
		return ResultEntity.ok();
	}
	
	/**
	 * 启用
	 * @param param
	 * @return
	 */
	@RequiresRoles(value={"admin"})
	@RequestMapping(value="/authenticated/wxmerchant/enable")
	@ResponseBody
    public ResultEntity enable(@RequestBody Map<String,Object> param){
		wxMerchantService.enable(param);
		return ResultEntity.ok();
	}
	/**
	 * 禁用
	 * @param param
	 * @return
	 */
	@RequiresRoles(value={"admin"})
	@RequestMapping(value="/authenticated/wxmerchant/disable")
	@ResponseBody
    public ResultEntity disable(@RequestBody Map<String,Object> param){
		wxMerchantService.disable(param);
		return ResultEntity.ok();
	}
}
